Skip to content

Fix field naming convention in auth plugin documentation#667

Merged
hotlong merged 2 commits into
mainfrom
copilot/fix-pnpm-dev-error
Feb 13, 2026
Merged

Fix field naming convention in auth plugin documentation#667
hotlong merged 2 commits into
mainfrom
copilot/fix-pnpm-dev-error

Conversation

Copilot AI commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Documentation showed camelCase field names (createdAt, updatedAt, emailVerified) that violate ObjectStack's snake_case validation for field identifiers.

Changes

  • packages/plugins/plugin-auth/README.md: Updated all code examples to use snake_case field names
  • content/docs/guides/authentication.mdx: Corrected field naming section to reflect protocol requirements

Corrected Examples

Before:

export const AuthUser = ObjectSchema.create({
  name: 'user',
  fields: {
    emailVerified: Field.boolean({ label: 'Email Verified' }),  // camelCase
    createdAt: Field.datetime({ label: 'Created At' }),
    updatedAt: Field.datetime({ label: 'Updated At' }),
  }
});

After:

export const AuthUser = ObjectSchema.create({
  name: 'user',
  fields: {
    email_verified: Field.boolean({ label: 'Email Verified' }),  // snake_case
    created_at: Field.datetime({ label: 'Created At' }),
    updated_at: Field.datetime({ label: 'Updated At' }),
  }
});

Implementation files already use correct snake_case. This fixes documentation only.

Original prompt

fix. pnpm dev error ,解决所有类似问题

Loading objectstack.config.ts...

✗ Unhandled error: [
{
"code": "invalid_key",
"origin": "record",
"issues": [
{
"origin": "string",
"code": "invalid_format",
"format": "regex",
"pattern": "/^[a-z_][a-z0-9_]$/",
"path": [],
"message": "Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")"
}
],
"path": [
"fields",
"createdAt"
],
"message": "Invalid key in record"
},
{
"code": "invalid_key",
"origin": "record",
"issues": [
{
"origin": "string",
"code": "invalid_format",
"format": "regex",
"pattern": "/^[a-z_][a-z0-9_]
$/",
"path": [],
"message": "Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")"
}
],
"path": [
"fields",
"updatedAt"
],
"message": "Invalid key in record"
},
{
"code": "invalid_key",
"origin": "record",
"issues": [
{
"origin": "string",
"code": "invalid_format",
"format": "regex",
"pattern": "/^[a-z_][a-z0-9_]*$/",
"path": [],
"message": "Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")"
}
],
"path": [
"fields",
"emailVerified"
],
"message": "Invalid key in record"
}
]
 ELIFECYCLE  Command failed with exit code 1.

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md

Created from VS Code.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Feb 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Feb 13, 2026 3:48pm
spec Ready Ready Preview, Comment Feb 13, 2026 3:48pm

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix pnpm dev error by resolving invalid field keys Fix field naming convention in auth plugin documentation Feb 13, 2026
Copilot AI requested a review from hotlong February 13, 2026 15:44
@hotlong
hotlong marked this pull request as ready for review February 13, 2026 16:05
Copilot AI review requested due to automatic review settings February 13, 2026 16:05
@hotlong
hotlong merged commit bcb6852 into main Feb 13, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects field naming convention violations in the authentication plugin documentation. The ObjectStack protocol requires field names to use snake_case (enforced by regex /^[a-z_][a-z0-9_]*$/ in packages/spec/src/data/object.zod.ts:263), but the documentation incorrectly showed examples using camelCase field names (createdAt, updatedAt, emailVerified). The actual implementation already uses correct snake_case naming; this PR fixes only the documentation to match.

Changes:

  • Updated all field name examples from camelCase to snake_case in README.md and authentication guide
  • Revised narrative descriptions to clarify that ObjectStack's snake_case convention is used for field names, not better-auth's native camelCase
  • Changed section title from "Migration from Other Systems" to "ObjectStack Field Naming" to better reflect the content

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/plugins/plugin-auth/README.md Corrected all code examples and descriptions to show snake_case field names (email_verified, created_at, updated_at, user_id, expires_at, etc.) instead of camelCase
content/docs/guides/authentication.mdx Updated field naming section to document ObjectStack's snake_case requirement and corrected field name examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants